﻿

$(function () {
    skipday();
    skipchanneltag();
});
function fixtag(gap) {
    var o = $('#flightdayhead');
    var top = o.position().top;
//    var gap = $(".info_content").height() - $(".info_topleft").height() + 150;
    if (gap > 0) { top = top - gap;}
    var nagType = getNagType();
    $(window).scroll(function () {
        var w = $(this);
        var st = w.scrollTop();
        if (st > top) {
            if (nagType == "IE6") {
                o.css({ 'position': "absolute", top: st });
            }
            else {
                o.attr("style", "position:fixed;top:0");
            }
        }
        else {
            if (nagType.indexOf("IE") >= 0) {
                o.css({ 'position': "" });
                o.attr("style", "position:absolute;");
            }
            else {
                o.attr("style", "position:absolute;");
            }
        }
        //滚动,当前行程样式变化
        var oList = $('#show1').find('a.aspc');
        oList.each(function (k, v) {
            var oo = $(this);
            var ootp = oo.position().top;
            if (ootp - 140 <= st) {
                $('#ulday').find('li').removeClass('on');
                $('#ulday').find('li').eq(k).addClass('on');
            }
        });
    });
}
function skipday() {
    $('#ulday').find('li').click(function () {
        var o = $(this);
        o.siblings('li').removeClass('on');
        o.addClass('on');
    });
}
function fixordertag(gap) {
    var o = $('#selectdate');
    var top = o.position().top;
//    var gap = $(".info_content").height() - $(".info_topleft").height() + 150;
    if (gap > 0) { top = top - gap; }
    var nagType = getNagType();
    $(window).scroll(function () {
        var w = $(this);
        var st = w.scrollTop();
        if (st > top) {
            if (nagType == "IE6") {
                o.css({ 'position': "absolute", top: st });
            }
            else {
                o.attr("style", "position:fixed;top:0");
            }
        }
        else {
            if (nagType.indexOf("IE") >= 0) {
                o.css({ 'position': "" });
                o.attr("style", "position:absolute;");
            }
            else {
                o.attr("style", "position:absolute;");
            }
        }
    });
}
//判断浏览器类型
function getNagType() {
    var type = navigator.appName;
    var version = navigator.appVersion;
    if (type == "Microsoft Internet Explorer") {
        var start = version.indexOf("MSIE");
        var end = version.indexOf(";", start);
        version = version.substring(start + 5, end);
        type = "IE";
    }
    version = parseFloat(version);
    return type + version;
}
function fixchanneltag(gap) {

    var o = $('#webbody_channeltag');
    var top = o.position().top;
    //    var gap = $(".info_content").height() - $(".info_topleft").height() + 150;
    if (gap > 0) { top = top - gap; }
    var nagType = getNagType();
    $(window).scroll(function () {
        var w = $(this);
        var st = w.scrollTop();
        if (st > top) {
            if (nagType == "IE6") {
                o.css({ 'position': "inherit", top: st });
            }
            else {
                o.attr("style", "position:fixed;top:0");
            }
        }
        else {
            if (nagType.indexOf("IE") >= 0) {
                o.css({ 'position': "" });
                o.attr("style", "position:inherit;");
            }
            else {
                o.attr("style", "position:inherit;");
            }
        }
        //滚动,当前行程样式变化
        var oList = $('#show1').find('a.aspc');
        oList.each(function (k, v) {
            var oo = $(this);
            var ootp = oo.position().top;
            if (ootp - 140 <= st) {
                $('#webbody_channeltag').find('a').removeClass('select');
                $('#webbody_channeltag').find('a').eq(k).addClass('select');
            }
        });
    });
}
function skipchanneltag() {
    $('#webbody_channeltag').find('a').click(function () {
        var o = $(this);
        o.siblings('a').removeClass('select');
        o.addClass('select');
    });
}

